﻿namespace Bean.Entity.Dto.PolicyPushDto;

/// <summary>
/// 同程易旅行公布政策推送类
/// </summary>
public class OtaEtravelPublicPolicyPushDto
{
    /// <summary>
    /// 
    /// </summary>
    private OtaEtravelPublicPolicyPushDto()
    {
    }

    /// <summary>
    /// 外部政策ID
    /// 单条政策唯一标识，用于更新或删除
    /// </summary>
    public string externalPolicyId { get; private set; }

    /// <summary>
    /// 政策代码
    /// </summary>
    public string policyCode { get; private set; }

    /// <summary>
    /// 0：不限 1：单程 2:往返
    /// </summary>
    public string travelType { get; private set; }

    /// <summary>
    /// 航司
    /// </summary>
    public string airline { get; private set; }

    /// <summary>
    /// 出发地 机场三字码
    /// ALL表示不限制
    /// </summary>
    public string depCities { get; private set; }

    /// <summary>
    /// 到达地 机场三字码
    /// ALL 标识不限制
    /// </summary>
    public string arrCities { get; private set; }

    /// <summary>
    /// 航线黑名单
    /// 为空表示不限制， 
    /// 格式CANSHA,CTU,PEK(*表示所有机场)，多个英文逗号”,
    /// </summary>
    public string routeForbid { get; private set; }

    /// <summary>
    /// 舱位
    /// 舱位代码，多个用“,”隔开
    /// </summary>
    public string cabin { get; private set; }

    /// <summary>
    /// 是否适用于共享航班
    /// （0:否, 1:是, 2:不限）
    /// </summary>
    public string canSharingAirline { get; private set; }

    /// <summary>
    /// 适用共享航司
    /// 航司二字码，多个用“,”隔开
    /// </summary>
    public string sharingAirline { get; private set; }

    /// <summary>
    /// 排除共享航司
    /// </summary>
    public string sharingAirlineForbid { get; private set; }

    /// <summary>
    /// 适用航班类型
    /// 单选 （0:全部, 1:适用航班, 2:不适用航班）
    /// </summary>
    public string goFlightRestrictType { get; private set; }

    /// <summary>
    /// 适用航班信息
    /// 往返用“,”隔开，多个航班号用”,”隔开，空表示不限制
    /// </summary>
    public string goFlightRestrict { get; private set; }

    /// <summary>
    /// 旅行日期
    /// 2018-08-01>2019-06-01，允许录入多个用,隔开表示或的关系
    /// </summary>
    public string goDateRestrict { get; private set; }


    /// <summary>
    /// 旅行排除日期
    /// 2018-08-01>2019-06-01，允许录入多个用,隔开表示或的关系，可为空表示不限制
    /// </summary>
    public string goDateRestrictForbid { get; private set; }

    /// <summary>
    /// 销售日期
    /// 销售日期：格式如2018-08-01>2019-06-01,多个“,”分割
    /// </summary>
    public string saleDateRestrict { get; private set; }

    /// <summary>
    /// 00:00-23:59，多个“,”分割，最多两段，为空表示不限制
    /// </summary>
    public string goTimeRestrict { get; private set; }

    /// <summary>
    /// 适用班期
    /// </summary>
    public string weekRestrict { get; private set; }

    /// <summary>
    /// 提前出票天数
    /// 空表示不限制
    /// </summary>
    public string advanceSaleDay { get; private set; }

    /// <summary>
    /// 最大出票天数
    /// 空表示不限制
    /// </summary>
    public string maxSaleDay { get; private set; }

    /// <summary>
    /// 出票时间
    /// 如09:00-20:00, 多个用/分割
    /// </summary>
    public string workTime { get; private set; }

    /// <summary>
    /// 乘客类型
    /// 1: 成人（目前仅支持） 2: 儿童
    /// </summary>
    public string passengerType { get; private set; }

    /// <summary>
    /// 返点
    /// 大于-0.4%，两位小数,无需输入“%” ,eg: “10.01”表示“10.01%”
    /// </summary>
    public string saleRetention { get; private set; }

    /// <summary>
    /// 留钱
    /// 单位：元，两位小数，-2.82表示亏钱-2.82元，20代表加价20元
    /// </summary>
    public string saleRebase { get; private set; }


    /// <summary>
    /// 票面区间最小值
    /// </summary>
    public string minPrice { get; private set; }

    /// <summary>
    /// 票面区间最大值
    /// </summary>
    public string maxPrice { get; private set; }


    /// <summary>
    /// 是否验价
    /// 0-不验价 1-验价
    /// </summary>
    public string isNeedPrice { get; private set; }

    /// <summary>
    /// 验价office号
    /// 是否验价=是，验价office必填（只允许录入供应商自身的office号，不允许录入平台的office号）
    /// </summary>
    public string testPriceOffice { get; private set; }

    /// <summary>
    /// 上浮金额
    /// </summary>
    public string upPrice { get; private set; }

    /// <summary>
    /// 适用年龄
    /// 年龄限制，如16-75，表示可售16-75岁，多段“,”分割，为空为不限制
    /// </summary>
    public string ageRestrict { get; private set; }

    /// <summary>
    /// 证件类型
    /// 0 : “不限”,1 : “身份证””2 : “签证””3 : “护照””4 : “军官证””5 : “回乡证””6 : “港澳通行证””7 : “台胞证””8 : “台湾通行证””9 : “海员证””10 : “户口簿””11 : “外国人永久居留证””12 : “港澳居住证””13 : “台湾居民居住证”” 多个
    /// </summary>
    public string credentialType { get; private set; }


    /// <summary>
    /// 身份证开头限制
    /// </summary>
    public string idcardPrefix { get; private set; }

    /// <summary>
    /// 报销凭证
    /// </summary>
    public string reimbursementVoucher { get; private set; }

    /// <summary>
    /// 是否换编	1/是
    /// </summary>
    public string isNeedBook { get; private set; }

    /// <summary>
    /// 是否代订座
    /// </summary>
    public string isReserveSeat { get; private set; }

    /// <summary>
    /// 余座阈值 是否代订座为2时，必填2-9数字，表示余坐低于多少时进行占座
    /// </summary>
    public string seatCount { get; private set; }

    /// <summary>
    /// 开票方式
    /// 1：BSP 2：B2B 3：官网 4：其它
    /// </summary>
    public string ticketType { get; private set; }

    /// <summary>
    /// 占座office号
    /// 占编office号，是否代订座为“都订座”或者“按余座”时必填（只允许录入供应商自身的office号，不允许录入平台的office号）
    /// </summary>
    public string bookingOffice { get; private set; }

    /// <summary>
    /// 开票office号
    /// </summary>
    public string ticketOffice { get; private set; }

    /// <summary>
    /// 授权office号
    /// </summary>
    public string authorizeOfficeCode { get; private set; }


    /// <summary>
    /// 0 否 1是
    /// 是否自动出票
    /// </summary>
    public string autoTicketing { get; private set; }

    /// <summary>
    /// 政策备注
    /// </summary>
    public string memo { get; private set; }


    public class Builder
    {
        private readonly OtaEtravelPublicPolicyPushDto _dto = new OtaEtravelPublicPolicyPushDto();

        /// <summary>
        /// 外部政策ID
        /// </summary>
        /// <param name="externalPolicyId">外部政策ID</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">外部政策ID不能为空</exception>
        public Builder SetExternalPolicyId(string externalPolicyId)
        {
            if (string.IsNullOrWhiteSpace(externalPolicyId))
            {
                throw new ArgumentException("外部政策ID不能为空", nameof(externalPolicyId));
            }

            _dto.externalPolicyId = externalPolicyId;
            return this;
        }

        /// <summary>
        /// 政策代码不能为空
        /// </summary>
        /// <param name="policyCode">政策代码</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">政策代码不能为空</exception>
        public Builder SetPolicyCode(string policyCode)
        {
            if (string.IsNullOrWhiteSpace(policyCode))
            {
                throw new ArgumentException("政策代码不能为空", nameof(policyCode));
            }

            _dto.policyCode = policyCode;
            return this;
        }

        /// <summary>
        /// 行程类型
        /// </summary>
        /// <param name="travelType">0：不限 1：单程 2:往返 （目前仅支付单程）</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        public Builder SetTravelType(string travelType)
        {
            if (string.IsNullOrWhiteSpace(travelType))
            {
                throw new ArgumentException("0：不限 1：单程 2:往返不能为空", nameof(travelType));
            }

            if (!new[] { "0", "1", "2" }.Contains(travelType))
            {
                throw new ArgumentException("0：不限 1：单程 2:往返必须是有效的值: 0, 1, 2", nameof(travelType));
            }

            _dto.travelType = travelType;
            return this;
        }

        /// <summary>
        /// 航司
        /// </summary>
        /// <param name="airline">航司二字代码, 只能一个航司。</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">航司不能为空</exception>
        public Builder SetAirline(string airline)
        {
            if (string.IsNullOrWhiteSpace(airline))
            {
                throw new ArgumentException("航司不能为空", nameof(airline));
            }

            _dto.airline = airline;
            return this;
        }

        /// <summary>
        /// 出发地 机场三字码
        /// </summary>
        /// <param name="depCities">出发地</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">出发地 机场三字码不能为空</exception>
        public Builder SetDepCities(string depCities)
        {
            // 为空说明不限制 出发机场
            if (string.IsNullOrWhiteSpace(depCities))
            {
                depCities = "ALL";
            }

            _dto.depCities = depCities;
            return this;
        }

        /// <summary>
        /// 到达地 机场三字码
        /// </summary>
        /// <param name="arrCities"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        public Builder SetArrCities(string arrCities)
        {
            // 为空说明不限制 到达机场
            if (string.IsNullOrWhiteSpace(arrCities))
            {
                arrCities = "ALL";
            }

            _dto.arrCities = arrCities;
            return this;
        }

        /// <summary>
        /// 航线黑名单
        /// 排除航线
        /// </summary>
        /// <param name="routeForbid"></param>
        /// <returns></returns>
        public Builder SetRouteForbid(string? routeForbid)
        {
            _dto.routeForbid = routeForbid ?? string.Empty;
            return this;
        }

        /// <summary>
        /// 适用舱位
        /// 舱位代码，多个用“,”隔开
        /// </summary>
        /// <returns></returns>
        public Builder SetCabin(string cabin)
        {
            if (string.IsNullOrWhiteSpace(cabin))
            {
                throw new ArgumentException("适用舱位不能为空", nameof(arrCities));
            }

            _dto.cabin = cabin;
            return this;
        }

        /// <summary>
        /// 是否适用于共享航班
        /// </summary>
        /// <param name="canSharingAirline">单选 （0:否, 1:是, 2:不限）</param>
        /// <returns></returns>
        /// <exception cref="ArgumentException"></exception>
        public Builder SetCanSharingAirline(string canSharingAirline)
        {
            if (!new[] { "0", "1", "2" }.Contains(canSharingAirline))
            {
                throw new ArgumentException("是否适用于共享航班必须是有效的值: 0, 1, 2", nameof(canSharingAirline));
            }


            canSharingAirline = canSharingAirline switch
            {
                "2" => "0",
                "0" => "2",
                _ => canSharingAirline
            };

            _dto.canSharingAirline = canSharingAirline;
            return this;
        }

        /// <summary>
        /// 适用共享航司
        /// 航司二字码，多个用“,”隔开
        /// </summary>
        /// <param name="sharingAirline"></param>
        /// <returns></returns>
        public Builder SetSharingAirline(string sharingAirline = "")
        {
            _dto.sharingAirline = sharingAirline;
            return this;
        }

        /// <summary>
        /// 排除共享航司
        /// </summary>
        /// <param name="sharingAirlineForbid"></param>
        /// <returns></returns>
        public Builder SetSharingAirlineForbid(string sharingAirlineForbid = "")
        {
            _dto.sharingAirlineForbid = sharingAirlineForbid;
            return this;
        }

        /// <summary>
        /// 适用航班类型 （0:全部, 1:适用航班, 2:不适用航班）
        /// 默认为0
        /// </summary>
        /// <param name="goFlightRestrictType"></param>
        /// <returns></returns>
        public Builder SetGoFlightRestrictType(string goFlightRestrictType = "0")
        {
            if (!new[] { "0", "1", "2" }.Contains(goFlightRestrictType))
            {
                throw new ArgumentException("适用航班类型必须是有效的值: 0, 1, 2", nameof(goFlightRestrictType));
            }

            _dto.goFlightRestrictType = goFlightRestrictType;
            return this;
        }

        /// <summary>
        /// 适用航班信息
        /// 往返用“,”隔开，多个航班号用”,”隔开，空表示不限制
        /// </summary>
        /// <param name="goFlightRestrict"></param>
        /// <returns></returns>
        public Builder SetGoFlightRestrict(string goFlightRestrict)
        {
            if (_dto.goFlightRestrictType != "0" && string.IsNullOrWhiteSpace(goFlightRestrict))
            {
                throw new ArgumentException("航班类型不为全部时,航班号不能为空", nameof(goFlightRestrict));
            }

            _dto.goFlightRestrict = goFlightRestrict;
            return this;
        }

        /// <summary>
        /// 旅行日期
        /// 2018-08-01>2019-06-01，允许录入多个用,隔开表示或的关系
        /// </summary>
        /// <param name="tripStartDate">旅行开始</param>
        /// <param name="tripendDate">旅行结束</param>
        /// <returns></returns>
        public Builder SetGoDateRestrict(string tripStartDate, string tripendDate)
        {
            var goDateRestrict = $"{tripStartDate}>{tripendDate}";
            _dto.goDateRestrict = goDateRestrict;
            return this;
        }

        /// <summary>
        /// 旅行排除日期
        /// 2018-08-01>2019-06-01，允许录入多个用,隔开表示或的关系，可为空表示不限制
        /// </summary>
        /// <returns></returns>
        public Builder SetGoDateRestrictForbid(string tripStartDate, string tripEndDate)
        {
            var goDateRestrictForbid = $"{tripStartDate}>{tripEndDate}";
            _dto.goDateRestrictForbid = goDateRestrictForbid;

            return this;
        }

        /// <summary>
        /// 销售日期
        /// 销售日期：格式如2018-08-01>2019-06-01,多个“,”分割
        /// </summary>
        /// <param name="saleStartDate">销售开始日期</param>
        /// <param name="saleEndDate">销售结束日期</param>
        /// <returns></returns>
        public Builder SetSaleDateRestrict(string saleStartDate, string saleEndDate)
        {
            if (string.IsNullOrWhiteSpace(saleStartDate) || string.IsNullOrWhiteSpace(saleEndDate))
            {
                throw new ArgumentException("销售日期不能为空", nameof(saleStartDate));
            }

            var saleDateRestrict = $"{saleStartDate}>{saleEndDate}";
            _dto.saleDateRestrict = saleDateRestrict;
            return this;
        }

        /// <summary>
        /// 适用旅行时间
        /// 00:00-23:59，多个“,”分割，最多两段，为空表示不限制
        /// </summary>
        /// <param name="tripStartTime"></param>
        /// <param name="tripEndTime"></param>
        /// <returns></returns>
        public Builder SetGoTimeRestrict(string tripStartTime, string tripEndTime)
        {
            var goTimeRestrict = string.Empty;
            if (!string.IsNullOrWhiteSpace(tripStartTime) && string.IsNullOrWhiteSpace(tripEndTime))
            {
                goTimeRestrict = $"{tripStartTime}-{tripEndTime}";
            }

            _dto.goTimeRestrict = goTimeRestrict;
            return this;
        }

        /// <summary>
        /// 适用班期
        /// </summary>
        /// <param name="weekRestrict">1,2,3,4,5,6,7</param>
        /// <returns></returns>
        public Builder SetWeekRestrict(string weekRestrict = "1,2,3,4,5,6,7")
        {
            _dto.weekRestrict = weekRestrict;
            return this;
        }

        /// <summary>
        /// 提前出票天数
        /// </summary>
        /// <param name="advanceSaleDay"></param>
        /// <returns></returns>
        public Builder SetAdvanceSaleDay(string advanceSaleDay = "")
        {
            _dto.advanceSaleDay = advanceSaleDay;
            return this;
        }

        /// <summary>
        /// 最大出票天数
        /// </summary>
        /// <param name="maxSaleDay"></param>
        /// <returns></returns>
        public Builder SetMaxSaleDay(string maxSaleDay = "")
        {
            _dto.maxSaleDay = maxSaleDay;
            return this;
        }

        /// <summary>
        /// 出票时间
        /// </summary>
        /// <param name="workTime"></param>
        /// <returns></returns>
        public Builder SetWorkTime(string workTime = "")
        {
            _dto.workTime = workTime;
            return this;
        }

        /// <summary>
        /// 适用乘客类型
        /// </summary>
        /// <param name="passengerType"></param>
        /// <returns></returns>
        public Builder SetPassengerType(string passengerType)
        {
            if (passengerType.Contains($","))
            {
                throw new InvalidDataException("数据无效 易旅行仅支持成人");
            }

            _dto.passengerType = passengerType;
            return this;
        }

        /// <summary>
        /// 返点
        /// </summary>
        /// <param name="saleRetention"></param>
        /// <returns></returns>
        public Builder SetSaleRetention(decimal saleRetention)
        {
            var saleRetentionStr = (Math.Round(saleRetention, 1, MidpointRounding.AwayFromZero)).ToString();
            _dto.saleRetention = saleRetentionStr;
            return this;
        }

        /// <summary>
        /// 留钱
        /// </summary>
        /// <param name="saleRebase"></param>
        /// <returns></returns>
        public Builder SetSaleRebase(decimal saleRebase)
        {
            _dto.saleRebase = saleRebase.ToString();
            return this;
        }

        /// <summary>
        /// 最低价
        /// </summary>
        /// <param name="minPrice"></param>
        /// <returns></returns>
        public Builder SetMinPrice(string minPrice)
        {
            _dto.minPrice = minPrice;
            return this;
        }

        /// <summary>
        /// 最高价
        /// </summary>
        /// <param name="maxPrice"></param>
        /// <returns></returns>
        public Builder SetMaxPrice(string maxPrice)
        {
            _dto.maxPrice = maxPrice;
            return this;
        }

        /// <summary>
        /// 是否需要验价
        /// 0-不验价 1-验价
        /// </summary>
        /// <param name="isNeedPrice"></param>
        /// <returns></returns>
        public Builder SetIsNeedPrice(string isNeedPrice = "0")
        {
            _dto.isNeedPrice = isNeedPrice;
            return this;
        }

        /// <summary>
        /// 验价Office号
        /// </summary>
        /// <param name="testPriceOffice"></param>
        /// <returns></returns>
        /// <exception cref="AggregateException"></exception>
        public Builder SetTestPriceOffice(string testPriceOffice)
        {
            if (_dto.isNeedPrice == "1" && string.IsNullOrWhiteSpace(_dto.isNeedPrice))
            {
                throw new AggregateException("需要验价时 验价Office号必填");
            }

            _dto.testPriceOffice = testPriceOffice;
            return this;
        }

        /// <summary>
        /// 上浮价
        /// </summary>
        /// <param name="upPrice"></param>
        /// <returns></returns>
        public Builder SetUpPrice(string upPrice)
        {
            _dto.upPrice = upPrice;
            return this;
        }

        /// <summary>
        /// 年龄限制 为空不限制
        /// </summary>
        /// <param name="ageRestrict"></param>
        /// <returns></returns>
        public Builder SetAgeRestrict(string ageRestrict = "")
        {
            _dto.ageRestrict = ageRestrict;
            return this;
        }

        /// <summary>
        /// 证件类型限制 为0不限制
        /// </summary>
        /// <param name="credentialType"></param>
        /// <returns></returns>
        public Builder SetCredentialType(string credentialType = "0")
        {
            _dto.credentialType = credentialType ?? "0";
            return this;
        }

        /// <summary>
        /// 证件类型开头限制
        /// </summary>
        /// <param name="idcardPrefix"></param>
        /// <returns></returns>
        public Builder SetIdcardPrefix(string idcardPrefix = "")
        {
            _dto.idcardPrefix = idcardPrefix;
            return this;
        }

        /// <summary>
        /// 报销凭证
        /// 0行程单 （普通政策仅支持行程单）
        /// </summary>
        /// <param name="reimbursementVoucher"></param>
        /// <returns></returns>
        public Builder SetReimbursementVoucher(string reimbursementVoucher = "0")
        {
            _dto.reimbursementVoucher = reimbursementVoucher;
            return this;
        }

        /// <summary>
        /// 是否换编
        /// 1是（只能传1）
        /// </summary>
        /// <param name="isNeedBook"></param>
        /// <returns></returns>
        public Builder SetIsNeedBook(string isNeedBook = "1")
        {
            _dto.isNeedBook = isNeedBook;
            return this;
        }

        /// <summary>
        ///是否代订座 
        /// </summary>
        /// <param name="isReserveSeat">0：否 1：都订座 2：按余座`</param>
        /// <returns></returns>
        public Builder SetIsReserveSeat(string isReserveSeat = "0")
        {
            _dto.isReserveSeat = isReserveSeat;
            return this;
        }

        /// <summary>
        /// 余座阈值
        /// 是否代订座为2时，必填2-9数字，表示余坐低于多少时进行占座
        /// </summary>
        /// <param name="seatCount"></param>
        /// <returns></returns>
        /// <exception cref="AggregateException"></exception>
        public Builder SetSeatCount(string seatCount = "")
        {
            //代订座为2时 必填
            if (_dto.isReserveSeat == "2" && string.IsNullOrWhiteSpace(seatCount))
            {
                throw new AggregateException("代订座为2时 余座阈值必填");
            }
            else
            {
                seatCount = "";
            }

            _dto.seatCount = seatCount;
            return this;
        }

        /// <summary>
        /// 开票方式
        /// </summary>
        /// <param name="ticketType">1：BSP 2：B2B 3：官网 4：其它</param>
        /// <returns></returns>
        public Builder SetTicketType(string ticketType = "4")
        {
            _dto.ticketType = ticketType;
            return this;
        }

        /// <summary>
        /// 占座office号
        /// 0：否 1：都订座 2：按余座`
        /// 占编office号，是否代订座为“都订座”或者“按余座”时必填
        /// </summary>
        /// <param name="bookingOffice"></param>
        /// <returns></returns>
        public Builder SetBookingOffice(string bookingOffice)
        {
            //代订座为2时 必填
            if (_dto.isReserveSeat is "2" or "1" && string.IsNullOrWhiteSpace(bookingOffice))
            {
                throw new AggregateException("占编office号，是否代订座为“都订座”或者“按余座”时必填");
            }

            _dto.bookingOffice = bookingOffice;
            return this;
        }

        /// <summary>
        /// 开票office号
        /// 航信配置号，如SZV111
        /// </summary>
        /// <param name="ticketOffice"></param>
        /// <returns></returns>
        /// <exception cref="AggregateException"></exception>
        public Builder SetTicketOffice(string ticketOffice)
        {
            _dto.ticketOffice = ticketOffice;
            return this;
        }

        /// <summary>
        /// 授权office号
        /// </summary>
        /// <param name="authorizeOfficeCode"></param>
        /// <returns></returns>
        public Builder SetAuthorizeOfficeCode(string authorizeOfficeCode)
        {
            _dto.authorizeOfficeCode = authorizeOfficeCode;
            return this;
        }

        /// <summary>
        /// 是否自动出票
        /// </summary>
        /// <param name="autoTicketing">0 否 1是</param>
        /// <returns></returns>
        public Builder SetAutoTicketing(string autoTicketing = "0")
        {
            _dto.autoTicketing = autoTicketing;
            return this;
        }

        /// <summary>
        /// 政策备注
        /// </summary>
        /// <param name="memo"></param>
        /// <returns></returns>
        public Builder SetMemo(string memo)
        {
            _dto.memo = memo;
            return this;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public OtaEtravelPublicPolicyPushDto Build()
        {
            // 可以在这里添加一些构建前的验证逻辑，确保所有必要的字段都已设置
            if (string.IsNullOrWhiteSpace(_dto.externalPolicyId))
            {
                throw new InvalidOperationException("外部政策ID不能为空");
            }

            if (string.IsNullOrWhiteSpace(_dto.policyCode))
            {
                throw new InvalidOperationException("政策代码不能为空");
            }

            if (string.IsNullOrWhiteSpace(_dto.airline))
            {
                throw new InvalidOperationException("航司不能为空");
            }

            if (string.IsNullOrWhiteSpace(_dto.depCities))
            {
                throw new InvalidOperationException("出发地 机场三字码不能为空");
            }

            if (string.IsNullOrWhiteSpace(_dto.arrCities))
            {
                throw new InvalidOperationException("到达地 机场三字码不能为空");
            }

            if (string.IsNullOrWhiteSpace(_dto.saleDateRestrict))
            {
                throw new InvalidOperationException("销售日期不能为空");
            }

            return _dto;
        }
    }
}